#!/user/bin/env node

const http = require('http'),
      addr = 'http://sample.wangding.co/web/one-div.html',
      url = require('url'),
      log = console.log;
let options = url.parse(global.encodeURI(addr));
options.headers = {
  'User-Agent':'01-my-crul.js'
};

http.get(options,(res)=>{
  log(`HTTP/${res.httpVersion} ${res.statusCode} ${res.statusMessage}`);
  log(res.headers)
  res.pipe(process.stdout);
})//请求页面，得到代码
